/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.gov.igac.observatorio.entidades.idea;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author jgamba
 */
@Entity
@Table(name = "infraestructura")
@NamedQueries({
    @NamedQuery(name = "Infraestructura.findAll", query = "SELECT i FROM Infraestructura i"),
    @NamedQuery(name = "Infraestructura.findByIdInfraestructura", query = "SELECT i FROM Infraestructura i WHERE i.idInfraestructura = :idInfraestructura"),
    @NamedQuery(name = "Infraestructura.findByTipo", query = "SELECT i FROM Infraestructura i WHERE i.tipo = :tipo")})
public class Infraestructura implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idInfraestructura")
    private Integer idInfraestructura;
    @Size(max = 45)
    @Column(name = "tipo")
    private String tipo;
    @OneToMany(mappedBy = "infraestructura")
    private List<Entidad> entidadList;

    public Infraestructura() {
    }

    public Infraestructura(Integer idInfraestructura) {
        this.idInfraestructura = idInfraestructura;
    }

    public Integer getIdInfraestructura() {
        return idInfraestructura;
    }

    public void setIdInfraestructura(Integer idInfraestructura) {
        this.idInfraestructura = idInfraestructura;
    }

    public String getTipo() {
        return tipo;
    }

    public void setTipo(String tipo) {
        this.tipo = tipo;
    }

    public List<Entidad> getEntidadList() {
        return entidadList;
    }

    public void setEntidadList(List<Entidad> entidadList) {
        this.entidadList = entidadList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idInfraestructura != null ? idInfraestructura.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Infraestructura)) {
            return false;
        }
        Infraestructura other = (Infraestructura) object;
        if ((this.idInfraestructura == null && other.idInfraestructura != null) || (this.idInfraestructura != null && !this.idInfraestructura.equals(other.idInfraestructura))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "co.gov.igac.observatorio.entidades.idea.Infraestructura[ idInfraestructura=" + idInfraestructura + " ]";
    }
    
}
